
#ifndef CUTOFFIMAGEDIALOG_H
#define CUTOFFIMAGEDIALOG_H

#include <BImage>
#include <BSpacer>
#include <BButton>
#include <BSpinBox>
#include <BDialog>

using namespace BWE;

class CutoffImageDialog : public BDialog
{
	BOBJECT(CutoffImageDialog)
public:
	CutoffImageDialog(BWidget* parent = 0);
	~CutoffImageDialog();

	void setImage(BImage* image);
	BImage* image();

protected:
	void slotConfirmButtonClicked();
	void slotCancelButtonClicked();

protected:
	virtual void adjustEvent(const BEvent& event);

	virtual void styleEvent(const BEvent& event);
	virtual void freshEvent(const BEvent& event);
	virtual void paintEvent(const BEvent& event);

	virtual void mousePressEvent(const BMouseEvent& mouseEvent);
	virtual void mouseReleaseEvent(const BMouseEvent& mouseEvent);
	virtual void mouseMoveEvent(const BMouseEvent& mouseEvent);

private:
	BHolder<BImage>		_image;
	BRect				_imageRect;
	BRect				_cutRect;
	BRect				_borderLeft;
	BRect				_borderTop;
	BRect				_borderRight;
	BRect				_borderBottom;
	BRect				_borderLeftTop;
	BRect				_borderLeftBottom;
	BRect				_borderRightTop;
	BRect				_borderRightBottom;

	Part				_resizePart;
	bool				_pressed;
	BPoint				_pressedPoint;
	BRectf				_pressedRect;

	BSpacer*			_imageSpacer;
	BSpinBox*			_widthSpinBox;
	BButton*			_resetWidthButton;
	BSpinBox*			_heightSpinBox;
	BButton*			_resetHeightButton;

	BButton*			_confirmButton;
	BButton*			_cancelButton;

};

#endif
